﻿<%@ Page Language="VB" MasterPageFile="~/Default.master" Title="News Articles" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ Register TagPrefix="Club" TagName="LoginBanner" Src="~/UserControls/LoginBanner.ascx" %>
<%@ Register TagPrefix="Club" TagName="ImageThumbnail" Src="~/UserControls/ImageThumbnail.ascx" %>
<%@ Register TagPrefix="Club" TagName="WebContent" Src="~/UserControls/WebContent.ascx" %>
<script runat="server">

    
    Private IsAdmin As Boolean
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        IsAdmin = User.IsInRole("Administrators")
        panel1.visible = IsAdmin
    End Sub

    Protected Sub ObjectDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs)
        Dim pages As Integer = ClubStarterKit.Web.News.NumPages()
        pn1.Count = pages
    End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="body">
        <Club:LoginBanner ID="LoginBanner1" runat="server" />
        <div id="columnleft">
            <a name="content_start" id="content_start"></a>
            <div class="leftblock">
            <Club:WebContent ID="WebContent1" runat="server" Section="news" />
                
                    <a href="../RSS/NewsRss.aspx">
                <asp:Image id="rss" runat="server" SkinID="rss" />
                </a>
                <div id="panel1" runat="server">
                    <br /><Club:RolloverLink ID="RemoveBtn" runat="server" Text="New Article" NavigateURL="Edit.aspx?Action=New" />
                </div>
            </div>
        </div>
        <div id="columnright">
            <div class="rightblock">
                <asp:ScriptManager id="ScriptManager1" runat="server">
                </asp:ScriptManager>&nbsp;
                <br />
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
               <div class="dashedline">
               <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="List" TypeName="ClubStarterKit.Web.News" OnSelecting="ObjectDataSource1_Selecting">
                    <SelectParameters>
                        <asp:ControlParameter Name="pagenum" ControlID="pn1" PropertyName="SelectedPage" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:Repeater ID="DataList1" runat="server" DataSourceID="ObjectDataSource1">
                    <ItemTemplate>
                        <div class="listitem">
                            <div class="thumbnail">
                                <a href='<%# "View.aspx?Articleid=" &Cstr( Eval("ID"))%>'>
                                    <Club:ImageThumbnail ID="ImageThumbnail1" runat="server" PhotoID='<%# Eval("photo") %>'
                                        />
                                </a>
                            </div>
                            <asp:panel ID="panel2" runat="server" Visible='<%# IsAdmin %>'>
                                <Club:RolloverLink ID="EditBtn" runat="server" Text="Edit" NavigateURL='<%# "Edit.aspx?Action=Edit&ArticleID=" & Cstr( Eval("ID")) %>' />
                                <Club:RolloverLink ID="RemoveBtn" runat="server" Text="Remove" NavigateURL='<%# "Edit.aspx?Action=Remove&ArticleID=" & Cstr( Eval("ID")) %>' />
                                <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="Are you sure you want to delete this article?" TargetControlID="RemoveBtn">
                                </cc1:ConfirmButtonExtender>
                            </asp:panel>
                            <h3>
                                <asp:Label ID="itemdateLabel" runat="server" Text='<%# Eval("itemdate","{0:d}") %>' />
                                &nbsp;&nbsp;&nbsp;&nbsp; <a href='<%# "view.aspx?articleid=" &Cstr( Eval("ID"))%>'>
                                    <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
                                </a>
                            </h3>
                            <p>
                                <asp:Label ID="descriptionLabel" runat="server" Text='<%# truncate(Convert.ToString(Eval("description"))) %>' />
                                <a href='<%# "view.aspx?articleid=" &Cstr( Eval("ID"))%>'>read more &raquo;</a></p>
                            <div class="clearlist">
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                   <br />
                    </div>
                <div class="newscrumbs">
                    Page:
                   <Club:PageNumberer ID="pn1" runat="server" SelectedPage="1" DisplayedPages="7" CssClass="PageNumbers" />
                </div>
                                </ContentTemplate>
                </asp:UpdatePanel>
                
                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                <ProgressTemplate>
                    <asp:Image ID="Loading1" SkinID="loading" runat="server" />
                </ProgressTemplate>
                </asp:UpdateProgress>
            </div>
        </div>
        <div class="clear2column"></div>
    </div>
</asp:Content>
